package com.enjoyor.soa.traffic.rest.efoms.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.enjoyor.soa.traffic.api.service.dubbo.efoms.IDubboPingConnectService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IPingConnectConsumeService;
import com.enjoyor.soa.traffic.util.enums.EnumAppCode;
import com.enjoyor.soa.traffic.util.helper.ResultHelper;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;
import org.springframework.stereotype.Component;

@Component
public class PingConnectConsumeService implements IPingConnectConsumeService {

	@Reference(version = "1.0.0",timeout = 10000)
    private IDubboPingConnectService dubboPingConnectService;
    
    /**
     * 查询网络实时数据
     * @param pingRealId 网络实时编号
     * @param devCategoryCode 设备种类编号
     * @param devTypeCode 设备类型编号
     * @param devId 设备编号
     * @param devName 设备名称
     * @param creatStartTime 记录开始时间
     * @param creatEndTime 记录结束时间
     * @return
     */
    @Override
    public ResultPojo selectPingConnectRealList(String pingRealId, String devCategoryCode, String devTypeCode,
			String devId, String devName, String creatStartTime, String creatEndTime) {
        ResultPojo resultPojo = new ResultPojo();
        try {
			resultPojo = dubboPingConnectService.selectPingConnectRealList(pingRealId, devCategoryCode, devTypeCode,
					devId, devName, creatStartTime, creatEndTime);
        }catch (Exception e ){
            e.printStackTrace();
            return ResultHelper.getResult(e,EnumAppCode.OPERATOR_FAILURE);
        }
        return resultPojo;
    }
    
    /**
     * 查询网络历史数据
     * @param pingHisId 网络历史编号
     * @param devCategoryCode 设备种类编号
     * @param devTypeCode 设备类型编号
     * @param devId 设备编号
     * @param devName 设备名称
     * @param creatStartTime 记录开始时间
     * @param creatEndTime 记录结束时间
     * @return
     * @return
     */
    @Override
    public ResultPojo selectPingConnectHisList(String pingHisId, String devCategoryCode, String devTypeCode,
			String devId, String devName, String creatStartTime, String creatEndTime) {
        ResultPojo resultPojo = new ResultPojo();
        try {
			resultPojo = dubboPingConnectService.selectPingConnectHisList(pingHisId, devCategoryCode, devTypeCode,
					devId, devName, creatStartTime, creatEndTime);
        }catch (Exception e ){
            e.printStackTrace();
            return ResultHelper.getResult(e,EnumAppCode.OPERATOR_FAILURE);
        }
        return resultPojo;
    }
}
